var express = require("express");
var router = express.Router();

var data = require("./detailData");

router.post("/info", (req, res, next) => {
  const { id } = req.body;
  if (id) {
    let a = data.find((item) => {
      return item.id === +id;
    });
    a = a || data[0];

    res.json({
      success: true,
      data: a,
    });
  } else {
    res.json({
      success: false,
      msg: "参数错误",
    });
  }
});

module.exports = router;
